.class public final Lcom/baidu/crabsdk/a/b;
.super Ljava/lang/Object;


# static fields
.field private static ad:Lcom/baidu/crabsdk/a/b;


# instance fields
.field private ae:Lcom/baidu/crabsdk/a/c;

.field private af:Z


# direct methods
.method private constructor <init>(Landroid/content/Context;)V
    .locals 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/baidu/crabsdk/a/b;->af:Z

    invoke-static {p1}, Lcom/baidu/crabsdk/a/c;->c(Landroid/content/Context;)Lcom/baidu/crabsdk/a/c;

    move-result-object p1

    iput-object p1, p0, Lcom/baidu/crabsdk/a/b;->ae:Lcom/baidu/crabsdk/a/c;

    return-void
.end method

.method public static a(Landroid/content/Context;)Lcom/baidu/crabsdk/a/b;
    .locals 0

    invoke-static {p0}, Lcom/baidu/crabsdk/a/b;->b(Landroid/content/Context;)Lcom/baidu/crabsdk/a/b;

    move-result-object p0

    return-object p0
.end method

.method private static b(Landroid/content/Context;)Lcom/baidu/crabsdk/a/b;
    .locals 2

    sget-object v0, Lcom/baidu/crabsdk/a/b;->ad:Lcom/baidu/crabsdk/a/b;

    if-nez v0, :cond_1

    const-class v0, Lcom/baidu/crabsdk/a/b;

    monitor-enter v0

    :try_start_0
    sget-object v1, Lcom/baidu/crabsdk/a/b;->ad:Lcom/baidu/crabsdk/a/b;

    if-nez v1, :cond_0

    new-instance v1, Lcom/baidu/crabsdk/a/b;

    invoke-direct {v1, p0}, Lcom/baidu/crabsdk/a/b;-><init>(Landroid/content/Context;)V

    sput-object v1, Lcom/baidu/crabsdk/a/b;->ad:Lcom/baidu/crabsdk/a/b;

    :cond_0
    monitor-exit v0

    goto :goto_0

    :catchall_0
    move-exception p0

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p0

    :cond_1
    :goto_0
    sget-object p0, Lcom/baidu/crabsdk/a/b;->ad:Lcom/baidu/crabsdk/a/b;

    return-object p0
.end method

.method public static i()Lcom/baidu/crabsdk/a/b;
    .locals 1

    sget-object v0, Lcom/baidu/crabsdk/a/b;->ad:Lcom/baidu/crabsdk/a/b;

    return-object v0
.end method


# virtual methods
.method public final start()V
    .locals 2

    iget-boolean v0, p0, Lcom/baidu/crabsdk/a/b;->af:Z

    if-nez v0, :cond_0

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/baidu/crabsdk/a/b;->af:Z

    :try_start_0
    invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;

    move-result-object v0

    iget-object v1, p0, Lcom/baidu/crabsdk/a/b;->ae:Lcom/baidu/crabsdk/a/c;

    iget-object v1, v1, Lcom/baidu/crabsdk/a/c;->ag:Lcom/baidu/crabsdk/a/l;

    invoke-virtual {v0, v1}, Landroid/os/Looper;->setMessageLogging(Landroid/util/Printer;)V

    const-string v0, "Start main-thread block monitoring!"

    invoke-static {v0}, Lcom/baidu/crabsdk/c/a;->s(Ljava/lang/String;)I
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    return-void

    :catch_0
    move-exception v0

    const-string v1, "setMessageLogging error!!"

    invoke-static {v1, v0}, Lcom/baidu/crabsdk/c/a;->a(Ljava/lang/String;Ljava/lang/Throwable;)I

    return-void

    :cond_0
    const-string v0, "Block monitoring has already started!"

    invoke-static {v0}, Lcom/baidu/crabsdk/c/a;->s(Ljava/lang/String;)I

    return-void
.end method

.method public final stop()V
    .locals 2

    iget-boolean v0, p0, Lcom/baidu/crabsdk/a/b;->af:Z

    if-eqz v0, :cond_0

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/baidu/crabsdk/a/b;->af:Z

    invoke-static {}, Landroid/os/Looper;->getMainLooper()Landroid/os/Looper;

    move-result-object v0

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Landroid/os/Looper;->setMessageLogging(Landroid/util/Printer;)V

    iget-object v0, p0, Lcom/baidu/crabsdk/a/b;->ae:Lcom/baidu/crabsdk/a/c;

    iget-object v0, v0, Lcom/baidu/crabsdk/a/c;->ah:Lcom/baidu/crabsdk/a/p;

    invoke-virtual {v0}, Lcom/baidu/crabsdk/a/n;->stop()V

    const-string v0, "Stop main-thread block monitoring!"

    :goto_0
    invoke-static {v0}, Lcom/baidu/crabsdk/c/a;->s(Ljava/lang/String;)I

    return-void

    :cond_0
    const-string v0, "Block monitoring is not enabled!"

    goto :goto_0
.end method
